import {_decorator, Component, Node, Collider2D, Contact2DType, IPhysics2DContact} from 'cc';

const {ccclass, property} = _decorator;

@ccclass('PipeEntryController')
export class PipeEntryController extends Component {
    start() {
        // 碰撞体
        let collider = this.node.getComponent(Collider2D);
        if (collider) {
            collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
        }
    }

    update(deltaTime: number) {

    }

    onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
        switch (otherCollider.tag) {
            case 0:
                console.log("小鸟死了...");
                break;
        }
    }
}

